# -*- coding: utf-8 -*-
import io
import os
import sys
import numpy

from setuptools import find_packages, setup, Extension

# Package meta-data.
NAME = 'qlib'
DESCRIPTION = 'A Quantitative-research Library'
URL = ''
EMAIL = 'dongzhou@pku.edu.cn'
AUTHOR = 'evanzd'
REQUIRES_PYTHON = '>=2.7.0, >=3.5.0'
VERSION = '0.1.2'

# What packages are required for this module to be executed?
REQUIRED = [
    'numpy', 'pandas', 'scipy', 'requests', \
]

# Numpy include
NUMPY_INCLUDE = numpy.get_include()

here = os.path.abspath(os.path.dirname(__file__))

with io.open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
    long_description = '\n' + f.read()

# cython qlib/_libs/*.pyx --cplus    
extensions = [
    Extension(
        "qlib._libs.rolling",
        ["qlib/_libs/rolling.pyx"],
        libraries=["m"],
        language="c++",
        include_dirs=[NUMPY_INCLUDE]
    ),
    Extension(
        "qlib._libs.expanding",
        ["qlib/_libs/expanding.pyx"],
        libraries=["m"],
        language="c++",
        include_dirs=[NUMPY_INCLUDE]
    ),
]

# Where the magic happens:
setup(
    name=NAME,
    version=VERSION,
    description=DESCRIPTION,
    long_description=long_description,
    author=AUTHOR,
    author_email=EMAIL,
    python_requires=REQUIRES_PYTHON,
    url=URL,
    packages=find_packages(exclude=('tests',)),
    # if your package is a single module, use this instead of 'packages':
    # py_modules=['qlib'],

    # entry_points={
    #     'console_scripts': ['mycli=mymodule:cli'],
    # },
    ext_modules=extensions,
    install_requires=REQUIRED,
    include_package_data=True,
    classifiers=[
        # Trove classifiers
        # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
        # 'License :: OSI Approved :: MIT License',
        'Development Status :: 3 - Alpha',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.7'
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.6',
    ],
)
